﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ECGWeb.Controls
{
    public partial class CommentDataTable : System.Web.UI.UserControl
    {
        public ECGService.Comment[] commentArray = null;

        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.comment_gridview.PageIndexChanging += comment_gridview_PageIndexChanging;
        }

        protected void comment_gridview_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            comment_gridview.PageIndex = e.NewPageIndex;
            comment_gridview.DataBind();
            commentUpdatePanel.Update();
        }

        public void setDataSource(ECGService.Comment[] cmts)
        {
            this.commentArray = cmts;
            comment_gridview.DataSource = cmts;
            comment_gridview.DataBind();
        }

        public void fakeCommentGridViewData()
        {
            ECGService.Comment[] cmtArrFake = new ECGService.Comment[1];
            cmtArrFake[0] = new ECGService.Comment();
            cmtArrFake[0].docName = "fake";
            cmtArrFake[0].docID = "fake";

            comment_gridview.DataSource = cmtArrFake;
            comment_gridview.DataBind();
            comment_gridview.Rows[0].Visible = false;
            comment_gridview.Rows[0].Controls.Clear();
        }
    }
}